import {LayerLink} from 'comps/common';
import * as React from 'react';
import {Table} from 'antd';
import ServiceDetail from '../containers/service-detail';

const ServiceManageList = ({services}) => {

  const columns = [
    {
      title: '服务名',
      dataIndex: 'id',
      key: 'id',
      render(id){
        return <LayerLink component={ServiceDetail} data={{id:id}}>{id}</LayerLink>
      }
    }, {
      title: '状态',
      dataIndex: 'status',
      key: 'status',
      render(status) {
        return {
          OK: <span className="color-success">正常</span>,
          NO_PROVIDER: <span className="color-danger">无提供者</span>,
          NO_CONSUMER: <span className="color-warning">无消费者</span>
        }[status];
      }
      //}, {
      //  title: '操作',
      //  key: 'operation',
      //  render() {
      //    return '管理';
      //  }
    }
  ];

  return (
    <div className="machine-search-list">
      <Table dataSource={services} columns={columns} pagination={false} size="middle" rowKey={record => record.id}/>
    </div>
  );
}

export default ServiceManageList;
